//
//  ArticleDetailTableViewCell.m
//  OneDay
//
//  Created by lanou3g on 15/11/1.
//  Copyright © 2015年 oneDay. All rights reserved.
//

#import "ArticleDetailTableViewCell.h"

@implementation ArticleDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.texTLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.04 * kWidth, 2, kWidth - 0.08 * kWidth, 0.09 * kHeight)];
        self.texTLabel.font = [UIFont systemFontOfSize:12];
        self.texTLabel.numberOfLines = 0;
        [self addSubview:self.texTLabel];
    }
    return self;
}

- (void)setModel:(ArticleDetailModel *)model
{
    OneDayObject *oneObject = [[OneDayObject alloc] init];
    
    CGRect newFrame = self.texTLabel.frame;
    newFrame.size.height = [oneObject sizeWithText:model.text font:12 width:kWidth - 0.08 * kWidth height:100000].height;
    self.texTLabel.frame = newFrame;
    self.texTLabel.text = [NSString stringWithFormat:@"%@", model.text];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
